#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>

#include "lib.h"
#include "type.h"
#include "cfg.h"

SZ_CB_T g_sz_cb;

#define DEBUG(format, arg...) \
        debug(TEST_MODULE_CONFIG, format, ##arg)
#define INFO(format, arg...) \
        info(TEST_MODULE_CONFIG, format, ##arg)
#define WARN(format, arg...) \
        warn(TEST_MODULE_CONFIG, format, ##arg)
#define ERROR(format, arg...) \
        error(TEST_MODULE_CONFIG, format, ##arg)



int update_cfg(SZ_CB_T *sz_cb){
    DDWORD cfg_bitmask = sz_cb->cfg_bitmask;
    int i;

    for (i = 0; cfg_bitmask; i++, cfg_bitmask >>= 1) {
        if (0 == (cfg_bitmask & 1)) continue;
        switch (i) {
            case YEAR_2000_DAY1:
                break;
            case YEAR_2000_DAY2:
                 break;
        }
    }

}

int get_bits_num(DDWORD num){
    int bits = 0;

    while(num){
        if(num & 1) bits++;          
        num >>=1;
    }
    return bits;
}

int test_cfg(){
    g_sz_cb.cfg_bitmask = 1UL << 50;

    g_sz_cb.cfg_bitmask |= SET_BIT(YEAR_2000_DAY1);
    g_sz_cb.cfg_bitmask |= SET_BIT(YEAR_2000_DAY2);
    g_sz_cb.cfg_bitmask |= SET_BIT(YEAR_2050_DAY2);
    DEBUG("size of DDWORD:%d", sizeof(DDWORD));
    DEBUG("cfg bits %llu 0x:%llx :%d",g_sz_cb.cfg_bitmask,  g_sz_cb.cfg_bitmask, get_bits_num(g_sz_cb.cfg_bitmask));
    update_cfg(&g_sz_cb);
    

    
}

